<?php
require_once 'Service/Condition.php';

/**
 * Field value is between min and max values.
 *
 * @author baziak
 */
class Service_Condition_ZendDb_Between extends Service_Condition
{
    protected $_operator = 'BETWEEN';

    public function __toString()
    {
        $db = $this->getDataSource()->getAdapter();

        $minValue = $this->_params['minValue'];
        $maxValue = $this->_params['maxValue'];

        $value = $db->quote($minValue) . ' AND ' . $db->quote($maxValue);
        
        $field = $db->quoteIdentifier($this->_params['field']);

        return $field .' '. $this->_operator .' '. $value;
    }
}
